/**
 * 
 */
package hawk.example;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.params.converter.SimpleArgumentConverter;

/**
 * @author Hawk
 *
 */
public class ToStringArgumentConverter extends SimpleArgumentConverter {
	@Override
	protected Object convert(Object source, Class<?> targetType) {
		assertEquals(String.class, targetType, "Can only convert to String");
		if (source instanceof Enum<?>) {
			return ((Enum<?>) source).name();
		}
		return String.valueOf(source);
	}
}
